$(function(){
	countryFlowIn("flowIn");
	countryFlowOut("flowOut");
	showPersonEducation("personEducation");
	populationStructure("populationStructure");
	specialDestribute("specialDestribute");
	minoritiDistribute("minoritiDistribute");
})
//人员迁入
function countryFlowIn(divName){

    var echartWidth = $(window).width() * 0.46;
    var echartHeight = $(window).height() * 0.55;
    //初始化echarts
    var myChart = echarts.init(document.getElementById(divName));
    myChart.resize({
        width: echartWidth,
        height: echartHeight,
    });
    //随机数
    function randomData() {
        return Math.round(Math.random()*10000);
    }

//城市坐标
    var geoCoordMap={
        '上海': [121.472644,31.231706 ],
        '北京': [116.405285,39.904989],
        '重庆': [106.504962,29.533155],
        '安徽': [117.283042,31.86119],
        '福建': [119.306239,26.075302],
        '甘肃': [103.823557,36.058039],
        '广西': [108.320004,22.82402],
        '贵州': [106.713478,26.578343],
        '海南': [110.33119,20.031971],
        '河北': [114.502461,38.045474],
        '河南': [113.665412,34.757975],
        '黑龙江': [126.642464,45.75696],
        '湖北': [114.298572,30.584355],
        '湖南': [112.982279,28.19409],
        '吉林': [125.3245,43.886841],
        '江苏': [118.767413,32.041544],
        '江西': [115.892151,28.676493],
        '辽宁': [123.429096,41.796767],
        '内蒙古': [111.670801,40.818311],
        '宁夏': [106.278179,38.46637],
        '青海': [101.778916,36.623178],
        '山东': [117.000923,36.675807],
        '陕西': [108.948024,34.263161],
        '山西': [112.549248,37.857014],
        '四川': [104.065735,30.659462],
        '天津': [117.190182,39.125596],
        '新疆': [87.617733,43.792818],
        '云南': [102.712251,25.040609],
        '浙江': [120.153576,30.287459],
        '西藏': [91.132212,29.660361],
        '广东':[113.280637,23.125178],
        '连云港': [119.221281999,34.596544]

    }

//前十的值
var data=[
    {name:'上海',value:95},
    {name:'北京',value:90},
    {name:'重庆',value:80},
    {name:'四川',value:70},
    {name:'河北',value:60},
    {name:'河南',value:50},
    {name:'山东',value:40},
    {name:'山西',value:30},
    {name:'安徽',value:30},
    {name:'福建',value:30},
    {name:'安徽',value:30},
    {name:'甘肃',value:30},
    {name:'广西',value:30},
    {name:'贵州',value:30},
    {name:'海南',value:30},
    {name:'黑龙江',value:30},
    {name:'湖北',value:30},
    {name:'湖南',value:30},
    {name:'吉林',value:30},
    {name:'江苏',value:30},
    {name:'江西',value:30},
    {name:'辽宁',value:30},
    {name:'内蒙古',value:30},
    {name:'宁夏',value:30},
    {name:'陕西',value:30},
    {name:'天津',value:30},
    {name:'新疆',value:30},
    {name:'云南',value:30},
    {name:'浙江',value:30},
    {name:'西藏',value:30},
    {name:'广东',value:30}

]


var $img = [
    {area: '河北', url:'img/bg.png'},
    {area: '广东', url:'img/bg.png'},
    {area: '香港', url:'img/bg.png'},
    {area: '澳门', url:'img/bg.png'},
    {area: '北京', url:'img/bg.png'},
    {area: '天津', url:'img/bg.png'},
    {area: '辽宁', url:'img/bg.png'},
    {area: '吉林', url:'img/bg.png'},
    {area: '黑龙江', url:'img/bg.png'},
    {area: '新疆', url:'img/bg.png'},
    {area: '宁夏', url:'img/bg.png'},
    {area: '甘肃', url:'img/bg.png'},
    {area: '陕西', url:'img/bg.png'},
    {area: '山西', url:'img/bg.png'},
    {area: '河北', url:'img/bg.png'},
    {area: '河南', url:'img/bg.png'},
    {area: '湖北', url:'img/bg.png'},
    {area: '湖南', url:'img/bg.png'},
    {area: '山东', url:'img/bg.png'},
    {area: '江苏', url:'img/bg.png'},
    {area: '安徽', url:'img/bg.png'},
    {area: '江西', url:'img/bg.png'},
    {area: '广西', url:'img/bg.png'},
    {area: '四川', url:'img/bg.png'},
    {area: '云南', url:'img/bg.png'},
    {area: '西藏', url:'img/bg.png'},
    {area: '浙江', url:'img/bg.png'},
    {area: '福建', url:'img/bg.png'},
    {area: '台湾', url:'img/bg.png'},
    {area: '重庆', url:'img/bg.png'},
    {area: '内蒙古', url:'img/bg.png'},
    {area: '贵州', url:'img/bg.png'},
    {area: '青海', url:'img/bg.png'},
    {area: '上海', url:'img/bg.png'},
    {area: '海南', url:'img/bg.png'}]


function formtGCData(geoData, data, srcNam, dest) {
    var tGeoDt = [];
    if (dest) {
        for (var i = 0, len = data.length; i < len; i++) {
            if (srcNam != data[i].name) {
                tGeoDt.push({
                    coords: [geoData[srcNam], geoData[data[i].name]]
                });
            }
        }
    } else {
        for (var i = 0, len = data.length; i < len; i++) {
            if (srcNam != data[i].name) {
                tGeoDt.push({
                    coords: [geoData[data[i].name], geoData[srcNam]]
                });
            }
        }
    }
    return tGeoDt;
}

function formtVData(geoData, data, srcNam) {
    var tGeoDt = [];
    for (var i = 0, len = data.length; i < len; i++) {
        var tNam = data[i].name
        if (srcNam != tNam) {
            tGeoDt.push({
                name: tNam,
                value: geoData[tNam]
            });
        }

    }
    tGeoDt.push({
        name: srcNam,
        value: geoData[srcNam],
        symbolSize: 8,
        itemStyle: {
            normal: {
                color: 'red',
                borderColor: '#fff'
            }
        }
    });
    return tGeoDt;
}
option = {

    title: {
//      text: '转移就业流入图',
//      left: '5',
//      top: '10px',
//      textStyle:{
//          color:"#fff"
//      }
    },
    /* tooltip: {
     trigger: 'item',
     },*/
    tooltip: {
        trigger: 'item',
        formatter: function (params,ticket,callback){
            var $pna = params.name;
            var res = '';

            for(var i = 0;i<$img.length;i++){
                if($img[i].area == $pna){
                    //res='<div> dddddd</div>'
                    //res = '<img src="'+ $img[i].url +'" />';//设置自定义数据的模板，这里的模板是图片
                    res=$img[i].area +'迁入人数 </br>'+'<div>8845人</div>'
                    //console.log(res);
                    break;
                }
            }

            setTimeout(function (){
                // 仅为了模拟异步回调
                callback(ticket, res);//回调函数，这里可以做异步请求加载的一些代码
            }, 500)
            return 'loading';

        }
    },
    /*visualMap: {
        min: 0,
        max: 12500,
        left: 'left',
        bottom: '3%',
        text: ['低','高'],           // 文本，默认为数值文本
        textStyle:{
            color:"#fff"
        },
        calculable: true,
       // color:['#e0ffff', '#006edd']
      //  color:['#FFFF99', '#FF6633']
        color:['#FF6633', '#FFFF99']
    },*/
    geo: {
        map: 'china',
        zoom: 1.20,//当前视角缩放比例
        label: {
            emphasis: {
                show: false
            }
        },
        //roam: true,
        silent: true,
        itemStyle: {
            normal: {
                color:'#fff',
                areaColor: '#37376e',
                borderColor: '#fff'
            },
            emphasis: {
                areaColor: '#2a333d'
            }
        }
    },
    series: [
        {

            type: 'lines',
            zlevel: 2,
            effect: {
                show: true,
                period: 6,
                trailLength: 0.1,
                color: '#fff150',//方向移动图形的颜色
                //symbol: planePath,
                symbolSize: 8
            },
            lineStyle: {
                normal: {
                    color: '#288cfa',
                    width: 1,
                    opacity: 0.4,
                    curveness: 0.2
                }
            },
            data: formtGCData(geoCoordMap, data, '连云港', false)
        },
        {

            type: 'effectScatter',//放射图圆点
            coordinateSystem: 'geo',
            zlevel: 2,
            rippleEffect: {
                period: 4,
                scale: 2.5,
                brushType: 'stroke'
            },
            label: {
                normal: {
                    show: true,
                    color: '#fff',
                    position: 'right',
                    formatter: '{b}'
                }
            },
            symbolSize: 5,
            itemStyle: {
                normal: {
                    color: '#288cfa',
                   // borderColor: 'gold'
                }
            },

            data: formtVData(geoCoordMap, data, '连云港')
        },{

            name: '资金流动 ',
            type: 'map',
            mapType: 'china',
            zoom: 1.20,//地图缩放比例设置
            // label: { normal: {show: false},emphasis: { show: true}},
			itemStyle: {
                    normal: {
                        borderColor: '#fff',
                        borderWidth: 1,
                        areaColor: "rgba(0,0,0,0.3)",//地图区域颜色
                    },
                    emphasis: {
                    	label:{
                    		
                    		textStyle: {
			                	color:'#fff150',
			                	fontWeight: 'bold',
			                },
                    	},
                        areaColor: "rgba(0,0,0,0.5)",
                        borderColor: '#337ab7',
                        borderWidth: 2,
                        shadowBlur: 2,
                        shadowColor: '#337ab7'
                    },
                    
               },
            data:[
                {name: '北京',value: randomData() },
                {name: '天津',value: randomData() },
                {name: '上海',value: randomData() },
                {name: '重庆',value: randomData() },
                {name: '河北',value: randomData() },
                {name: '河南',value: randomData() },
                {name: '云南',value: randomData() },
                {name: '辽宁',value: randomData() },
                {name: '黑龙江',value: randomData() },
                {name: '湖南',value: randomData() },
                {name: '安徽',value: randomData() },
                {name: '山东',value: randomData() },
                {name: '新疆',value:0 },
                {name: '江苏',value: randomData() },
                {name: '浙江',value: randomData() },
                {name: '江西',value: randomData() },
                {name: '湖北',value: randomData() },
                {name: '广西',value: randomData() },
                {name: '甘肃',value: randomData() },
                {name: '山西',value: randomData() },
                {name: '内蒙古',value: randomData() },
                {name: '陕西',value: randomData() },
                {name: '吉林',value: randomData() },
                {name: '福建',value: 0 },
                {name: '贵州',value: randomData() },
                {name: '广东',value: randomData() },
                {name: '青海',value: randomData() },
                {name: '西藏',value: randomData() },
                {name: '四川',value: randomData() },
                {name: '宁夏',value: randomData() },
                {name: '海南',value: randomData() },
                {name: '台湾',value: randomData() },
                {name: '香港',value: randomData() },
                {name: '澳门',value: randomData() }
            ]

        }]
};

myChart.setOption(option);
}
//人员迁出
function countryFlowOut(divName){
    var echartWidth = $(window).width() * 0.46;
    var echartHeight = $(window).height() * 0.55;
    //初始化echarts
    var myChart = echarts.init(document.getElementById(divName));
    myChart.resize({
        width: echartWidth,
        height: echartHeight,
    });
    //随机数
    function randomData() {
        return Math.round(Math.random()*10000);
    }

//城市坐标
    var geoCoordMap={
        '上海': [121.472644,31.231706 ],
        '北京': [116.405285,39.904989],
        '重庆': [106.504962,29.533155],
        '安徽': [117.283042,31.86119],
        '福建': [119.306239,26.075302],
        '甘肃': [103.823557,36.058039],
        '广西': [108.320004,22.82402],
        '贵州': [106.713478,26.578343],
        '海南': [110.33119,20.031971],
        '河北': [114.502461,38.045474],
        '河南': [113.665412,34.757975],
        '黑龙江': [126.642464,45.75696],
        '湖北': [114.298572,30.584355],
        '湖南': [112.982279,28.19409],
        '吉林': [125.3245,43.886841],
        '江苏': [118.767413,32.041544],
        '江西': [115.892151,28.676493],
        '辽宁': [123.429096,41.796767],
        '内蒙古': [111.670801,40.818311],
        '宁夏': [106.278179,38.46637],
        '青海': [101.778916,36.623178],
        '山东': [117.000923,36.675807],
        '陕西': [108.948024,34.263161],
        '山西': [112.549248,37.857014],
        '四川': [104.065735,30.659462],
        '天津': [117.190182,39.125596],
        '新疆': [87.617733,43.792818],
        '云南': [102.712251,25.040609],
        '浙江': [120.153576,30.287459],
        '西藏': [91.132212,29.660361],
        '广东':[113.280637,23.125178],
        '连云港': [119.221281999,34.596544]

    }

//前十的值
var data=[
    {name:'上海',value:95},
    {name:'北京',value:90},
    {name:'重庆',value:80},
    {name:'四川',value:70},
    {name:'河北',value:60},
    {name:'河南',value:50},
    {name:'山东',value:40},
    {name:'山西',value:30},
    {name:'安徽',value:30},
    {name:'福建',value:30},
    {name:'安徽',value:30},
    {name:'甘肃',value:30},
    {name:'广西',value:30},
    {name:'贵州',value:30},
    {name:'海南',value:30},
    {name:'黑龙江',value:30},
    {name:'湖北',value:30},
    {name:'湖南',value:30},
    {name:'吉林',value:30},
    {name:'江苏',value:30},
    {name:'江西',value:30},
    {name:'辽宁',value:30},
    {name:'内蒙古',value:30},
    {name:'宁夏',value:30},
    {name:'陕西',value:30},
    {name:'天津',value:30},
    {name:'新疆',value:30},
    {name:'云南',value:30},
    {name:'浙江',value:30},
    {name:'西藏',value:30},
    {name:'广东',value:30}

]


var $img = [
    {area: '河北', url:'img/bg.png'},
    {area: '广东', url:'img/bg.png'},
    {area: '香港', url:'img/bg.png'},
    {area: '澳门', url:'img/bg.png'},
    {area: '北京', url:'img/bg.png'},
    {area: '天津', url:'img/bg.png'},
    {area: '辽宁', url:'img/bg.png'},
    {area: '吉林', url:'img/bg.png'},
    {area: '黑龙江', url:'img/bg.png'},
    {area: '新疆', url:'img/bg.png'},
    {area: '宁夏', url:'img/bg.png'},
    {area: '甘肃', url:'img/bg.png'},
    {area: '陕西', url:'img/bg.png'},
    {area: '山西', url:'img/bg.png'},
    {area: '河北', url:'img/bg.png'},
    {area: '河南', url:'img/bg.png'},
    {area: '湖北', url:'img/bg.png'},
    {area: '湖南', url:'img/bg.png'},
    {area: '山东', url:'img/bg.png'},
    {area: '江苏', url:'img/bg.png'},
    {area: '安徽', url:'img/bg.png'},
    {area: '江西', url:'img/bg.png'},
    {area: '广西', url:'img/bg.png'},
    {area: '四川', url:'img/bg.png'},
    {area: '云南', url:'img/bg.png'},
    {area: '西藏', url:'img/bg.png'},
    {area: '浙江', url:'img/bg.png'},
    {area: '福建', url:'img/bg.png'},
    {area: '台湾', url:'img/bg.png'},
    {area: '重庆', url:'img/bg.png'},
    {area: '内蒙古', url:'img/bg.png'},
    {area: '贵州', url:'img/bg.png'},
    {area: '青海', url:'img/bg.png'},
    {area: '上海', url:'img/bg.png'},
    {area: '海南', url:'img/bg.png'}]

//dest真假调整移动图标的方向
function formtGCData(geoData, data, srcNam, dest) {
    var tGeoDt = [];
    if (dest) {
        for (var i = 0, len = data.length; i < len; i++) {
            if (srcNam != data[i].name) {
                tGeoDt.push({
                    coords: [geoData[srcNam], geoData[data[i].name]]
                });
            }
        }
    } else {
        for (var i = 0, len = data.length; i < len; i++) {
            if (srcNam != data[i].name) {
                tGeoDt.push({
                    coords: [geoData[data[i].name], geoData[srcNam]]
                });
            }
        }
    }
    return tGeoDt;
}

function formtVData(geoData, data, srcNam) {
    var tGeoDt = [];
    for (var i = 0, len = data.length; i < len; i++) {
        var tNam = data[i].name
        if (srcNam != tNam) {
            tGeoDt.push({
                name: tNam,
                value: geoData[tNam]
            });
        }

    }
    tGeoDt.push({
        name: srcNam,
        value: geoData[srcNam],
        symbolSize: 8,
        itemStyle: {
            normal: {
                color: 'red',
                borderColor: '#fff'
            }
        }
    });
    return tGeoDt;
}
option = {

    title: {
//      text: '转移就业流入图',
//      left: '5',
//      top: '10px',
//      textStyle:{
//          color:"#fff"
//      }
    },
    /* tooltip: {
     trigger: 'item',
     },*/
    tooltip: {
        trigger: 'item',
        formatter: function (params,ticket,callback){
            var $pna = params.name;
            var res = '';

            for(var i = 0;i<$img.length;i++){
                if($img[i].area == $pna){
                    //res='<div> dddddd</div>'
                    //res = '<img src="'+ $img[i].url +'" />';//设置自定义数据的模板，这里的模板是图片
                    res=$img[i].area +'迁出人数 </br>'+'<div>8845人</div>'
                    //console.log(res);
                    break;
                }
            }

            setTimeout(function (){
                // 仅为了模拟异步回调
                callback(ticket, res);//回调函数，这里可以做异步请求加载的一些代码
            }, 500)
            return 'loading';

        }
    },
    /*visualMap: {
        min: 0,
        max: 12500,
        left: 'left',
        bottom: '3%',
        text: ['低','高'],           // 文本，默认为数值文本
        textStyle:{
            color:"#fff"
        },
        calculable: true,
       // color:['#e0ffff', '#006edd']
      //  color:['#FFFF99', '#FF6633']
        color:['#FF6633', '#FFFF99']
    },*/
    geo: {
        map: 'china',
        zoom: 1.20,//当前视角缩放比例
        label: {
            emphasis: {
                show: false
            }
        },
        //roam: true,
        silent: true,
        itemStyle: {
            normal: {
                color:'#fff',
                areaColor: '#37376e',
                borderColor: '#fff'
            },
            emphasis: {
                areaColor: '#2a333d'
            }
        }
    },
    series: [
        {

            type: 'lines',
            zlevel: 2,
            effect: {
                show: true,
                period: 6,
                trailLength: 0.1,
                color: '#fff150',//方向移动图形的颜色
                //symbol: planePath,
                symbolSize: 8
            },
            lineStyle: {
                normal: {
                    color: '#288cfa',
                    width: 1,
                    opacity: 0.4,
                    curveness: 0.2
                }
            },
            data: formtGCData(geoCoordMap, data, '连云港', true)
        },
        {

            type: 'effectScatter',//放射图圆点
            coordinateSystem: 'geo',
            zlevel: 2,
            rippleEffect: {
                period: 4,
                scale: 2.5,
                brushType: 'stroke'
            },
            label: {
                normal: {
                    show: true,
                    color: '#fff',
                    position: 'right',
                    formatter: '{b}'
                }
            },
            symbolSize: 5,
            itemStyle: {
                normal: {
                    color: '#288cfa',
                   // borderColor: 'gold'
                }
            },

            data: formtVData(geoCoordMap, data, '连云港')
        },{

            name: '资金流动 ',
            type: 'map',
            mapType: 'china',
            zoom: 1.20,//地图缩放比例设置
            // label: { normal: {show: false},emphasis: { show: true}},
			itemStyle: {
                    normal: {
                        borderColor: '#fff',
                        borderWidth: 1,
                        areaColor: "rgba(0,0,0,0.3)",//地图区域颜色
                    },
                    emphasis: {
                    	label:{
                    		
                    		textStyle: {
			                	color:'#fff150',
			                	fontWeight: 'bold',
			                },
                    	},
                        areaColor: "rgba(0,0,0,0.5)",
                        borderColor: '#337ab7',
                        borderWidth: 2,
                        shadowBlur: 2,
                        shadowColor: '#337ab7'
                    },
                    
               },
            data:[
                {name: '北京',value: randomData() },
                {name: '天津',value: randomData() },
                {name: '上海',value: randomData() },
                {name: '重庆',value: randomData() },
                {name: '河北',value: randomData() },
                {name: '河南',value: randomData() },
                {name: '云南',value: randomData() },
                {name: '辽宁',value: randomData() },
                {name: '黑龙江',value: randomData() },
                {name: '湖南',value: randomData() },
                {name: '安徽',value: randomData() },
                {name: '山东',value: randomData() },
                {name: '新疆',value:0 },
                {name: '江苏',value: randomData() },
                {name: '浙江',value: randomData() },
                {name: '江西',value: randomData() },
                {name: '湖北',value: randomData() },
                {name: '广西',value: randomData() },
                {name: '甘肃',value: randomData() },
                {name: '山西',value: randomData() },
                {name: '内蒙古',value: randomData() },
                {name: '陕西',value: randomData() },
                {name: '吉林',value: randomData() },
                {name: '福建',value: 0 },
                {name: '贵州',value: randomData() },
                {name: '广东',value: randomData() },
                {name: '青海',value: randomData() },
                {name: '西藏',value: randomData() },
                {name: '四川',value: randomData() },
                {name: '宁夏',value: randomData() },
                {name: '海南',value: randomData() },
                {name: '台湾',value: randomData() },
                {name: '香港',value: randomData() },
                {name: '澳门',value: randomData() }
            ]

        }]
};

myChart.setOption(option);
}
//人口年龄结构
function populationStructure(id){
	var echartWidth = $(window).width() * 0.15;
	var echartHeight = $(window).height() * 0.28;
	// 基于准备好的dom，初始化echarts实例
	var myChart = echarts.init(document.getElementById(id));
	/*根据浏览器宽、高设置echarts 宽、高*/
	
	myChart.resize({
	    width: echartWidth,
	    height: echartHeight,
	});
	/*end*/
	//------------------------------------引用请注明出处

	var myData = ['20岁以下', '21~25岁', '26~30岁', '31~35岁', '36~40岁', '45~46岁', '50~55岁', '60岁以上'];
	var databeast = {
	    1: [239, 259, 362, 424, 532, 376, 296, 194],
	};
	var databeauty = {
	    1: [221, 288, 333, 409, 633, 408, 297, 183],
	};

	option = {
	    baseOption: {
	        //backgroundColor: '#000',
	        
	        title: {
	            /*text:'年龄段分布对比', 
	            top: '1%',
	            left: '1%',
	            textStyle: {
	                color: '#fff',
	                fontSize: 16,
	            },*/
	            //subtext: '作者:花自飘凌水自流',
	        },
	        legend: {
	            data: ['男性', '女性'],
	            top: 4,
	            right: '20%',
	            textStyle: {
	                color: '#fff',
	            },
	        },
	        tooltip: {
	            show: true,
	            trigger: 'axis',
	            formatter: '{b}<br/>{a}: {c}人',
	            axisPointer: {
	                type: 'shadow',
	            }
	        },

	        /* toolbox:{
	            right:'4%',
	            feature:{
	                //saveAsImage: {},
	                //restore: {},
	                //dataView: {},
	                //dataZoom: {},
	                magicType: {
	                    type:['line','bar'],
	                },
	                // brush: {},
	            }
	        },*/

	        grid: [{
	            show: false,
	            left: '5%',
	            top: '5%',
	            bottom: '5%',
	            containLabel: true,
	            width: '56%',
	        }, {
	            show: false,
	            left: '50.5%',
	            top: '15%',
	            bottom: '5%',
	            width: '0%',
	        }, {
	            show: false,
	            right: '10%',
	            top: '5%',
	            bottom: '5%',
	            containLabel: true,
	            width: '56%',
	        }, ],

	        xAxis: [
	            {
	            type: 'value',
	            inverse: true,
	            axisLine: {
	                show: false,
	            },
	            axisTick: {
	                show: false,
	            },
	            position: 'top',
	            axisLabel: {
	                show: false,
	                textStyle: {
	                    color: '#fff',
	                    fontSize: 12,
	                },
	            },
	            splitLine: {//图形背景线条
	                show: false,
	                lineStyle: {
	                    color: '#fff',
	                    width: 1,
	                    type: 'solid',
	                },
	            },
	        }, {
	            gridIndex: 1,
	            show: false,
	        }, {
	            gridIndex: 2,
	            type: 'value',
	            axisLine: {
	                show: false,
	            },
	            axisTick: {
	                show: false,
	            },
	            position: 'top',
	            axisLabel: {
	                show: false,
	                textStyle: {
	                    color: '#fff',
	                    fontSize: 12,
	                },
	            },
	            splitLine: {//图形背景线条
	                show: false,
	                lineStyle: {
	                    color: '#fff',
	                    width: 1,
	                    type: 'solid',
	                },
	            },
	        }, ],
	        yAxis: [{
	            type: 'category',
	            inverse: true,
	            position: 'right',
	            axisLine: {
	                show: false
	            },
	            axisTick: {
	                show: false
	            },
	            axisLabel: {
	                show: false,
	                margin: 8,
	                textStyle: {
	                    color: '#fff',
	                    fontSize: 12,
	                },

	            },
	            data: myData,
	        }, {
	            gridIndex: 1,
	            type: 'category',
	            inverse: true,
	            position: 'left',
	            axisLine: {
	                show: false
	            },
	            axisTick: {
	                show: false
	            },
	            axisLabel: {
	                show: true,
	                textStyle: {
	                    color: '#fff',
	                    fontSize: 12,
	                },

	            },
	            data: myData.map(function(value) {
	                return {
	                    value: value,
	                    textStyle: {
	                        align: 'center',
	                    }
	                }
	            }),
	        }, {
	            gridIndex: 2,
	            type: 'category',
	            inverse: true,
	            position: 'left',
	            axisLine: {
	                show: false
	            },
	            axisTick: {
	                show: false
	            },
	            axisLabel: {
	                show: false,
	                textStyle: {
	                    color: '#9D9EA0',
	                    fontSize: 12,
	                },

	            },
	            data: myData,
	        }, ],
	        series: [{
	                name: '男性',
	                type: 'bar',
	                barGap: 20,
	                barWidth: '60%',
	                label: {
	                    normal: {
	                    	position: 'left',
			                show: false,
			                color: '#fff'
	                    },
	                    emphasis: {
	                        show: false,
	                        position: 'left',
	                        offset: [0, 0],
	                        textStyle: {
	                            color: '#fff',
	                            fontSize: 14,
	                        },
	                    },
	                },
	                itemStyle: {
	                    normal: {
	                        color: '#35acfe'
	                    },
	                    emphasis: {
	                        color: '#08C7AE',
	                    },
	                },
	                data: databeast[1],
	            },


	            {
	                name: '女性',
	                type: 'bar',
	                barGap: 20,
	                barWidth: "60%",
	                xAxisIndex: 2,
	                yAxisIndex: 2,
	                label: {
	                    normal: {
	                    	position: 'right',
			                show: false,
			                color: '#fff'
	                    },
	                    emphasis: {
	                        show: false,
	                        position: 'right',
	                        offset: [0, 0],
	                        textStyle: {
	                            color: '#fff',
	                            fontSize: 14,
	                        },
	                    },
	                },
	                itemStyle: {
	                    normal: {
	                        color: '#f48b38'
	                    },
	                    emphasis: {
	                        color: '#F94646',
	                    },
	                },
	                data: databeauty[1],
	            }
	        ]

	    },

	   // options: [],


	};

	/* for (var i = 0; i < timeLineData.length; i++) {
	    option.baseOption.timeline.data.push(timeLineData[i]);
	    option.options.push({
	       title: {
	           text: '大北京' + timeLineData[i] + '月份城区景点帅哥美女统计',
	       },
	        series: [{
	                name: '招聘',
	                type: 'bar',
	                barGap: 20,
	                barWidth: 20,
	                label: {
	                    normal: {
	                        show: false,
	                    },
	                    emphasis: {
	                        show: true,
	                        position: 'left',
	                        offset: [0, 0],
	                        textStyle: {
	                            color: '#fff',
	                            fontSize: 14,
	                        },
	                    },
	                },
	                itemStyle: {
	                    normal: {
	                        color: '#659F83',
	                    },
	                    emphasis: {
	                        color: '#08C7AE',
	                    },
	                },
	                data: databeast[timeLineData[i]],
	            },
	
	
	            {
	                name: '求职',
	                type: 'bar',
	                barGap: 20,
	                barWidth: 20,
	                xAxisIndex: 2,
	                yAxisIndex: 2,
	                label: {
	                    normal: {
	                        show: false,
	                    },
	                    emphasis: {
	                        show: true,
	                        position: 'right',
	                        offset: [0, 0],
	                        textStyle: {
	                            color: '#fff',
	                            fontSize: 14,
	                        },
	                    },
	                },
	                itemStyle: {
	                    normal: {
	                        color: '#F68989',
	                    },
	                    emphasis: {
	                        color: '#F94646',
	                    },
	                },
	                data: databeauty[timeLineData[i]],
	            }
	        ]
	    });
	} */

	// 使用刚指定的配置项和数据显示图表。
	myChart.setOption(option);
}
//人口教育结构
function showPersonEducation(divName){
    var echartWidth = $(window).width() * 0.28;
    var echartHeight = $(window).height() * 0.25;
    //初始化echarts
    var myChart = echarts.init(document.getElementById(divName));
    myChart.resize({
        width: echartWidth,
        height: echartHeight,
    });
    option = {
        title : {
//          text: '人员身份构成比例',
//          textStyle:{
//              color:'#fff'
//          }
            //subtext: '纯属虚构',
            //x:'center'
        },
        color: ["#ed4743", "#54ba9b", "#f48b38", "#35acfe","#f467ce"],
        tooltip : {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
//      legend: {
//          right:'right',
//          // x : 'center',
//          // y : 'bottom',
//          data:['本科','博士','硕士','大专','其他'],
//          textStyle:{
//              color:"#fff"
//          }
//      },
        grid: {
            left: '5%',
            right: '5%',
            // top: '20%',
        	bottom: '5%',
            containLabel: true
        },
        /* toolbox: {
             show : true,
             feature : {
                 mark : {show: true},
                 dataView : {show: true, readOnly: false},
                 magicType : {
                     show: true,
                     type: ['pie', 'funnel']
                 },
                 restore : {show: true},
                 saveAsImage : {show: true}
             }
         },*/
        calculable : true,
        series : [

            {
                name:'面积模式',
                type:'pie',
                radius : [15, 60],
                center : ['45%', '50%'],
                roseType : 'radius',
                itemStyle: {
                	normal:{
                		label:{
                			show: true,
                			formatter: '{b}({d}%)'
                		},
                		labelLine:{
		                	show: true,
		                	length: 10,
		                	length2: 10
		                },
                	}
                },
                
                data:[
                    {value:10, name:'本科'},
                    {value:5, name:'博士'},
                    {value:15, name:'硕士'},
                    {value:25, name:'大专'},
                    {value:20, name:'其他'}

                ]
            }
        ]
    };
    myChart.setOption(option);

}
//各区特殊人群分布
function specialDestribute(id){
	var echartWidth = $(window).width() * 0.166;
	var echartHeight = $(window).height() * 0.36;
	// 基于准备好的dom，初始化echarts实例
	var myChart = echarts.init(document.getElementById(id));
	/*根据浏览器宽、高设置echarts 宽、高*/
	
	myChart.resize({
	    width: echartWidth,
	    height: echartHeight,
	});
	/*end*/
	//var dataAll = [389, 259, 262, 324, 232, 176, 196, 214, 133, 370];
	//var yAxisData = ['原因1','原因2','原因3','原因4','原因5','原因6','原因7','原因8','原因9','原因10'];
	function numDescSort(a,b){//进行降序排序操作
		return a.value - b.value;
	}
	var convertData = [
		{name:'海州区',value: 389},
		{name:'新浦区',value: 259},
		{name:'连云区',value: 262},
		{name:'赣榆区',value: 324},
		{name:'灌云县',value: 232},
		{name:'东海县',value: 176},
		{name:'灌南县',value: 196}
	];//数据
	var dataTitle = [];//标题
	convertData.sort(numDescSort);//对数据进行排序操作
	for(var i = 0 ;i < convertData.length; i++){
		dataTitle.push(convertData[i].name);
	}
	//定义不同的渐变色
	function colors(num){
		var color;
		if(num ==1){
			color = new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
            "offset": 0,
            "color": "#ffb069" // 0% 处的颜色
        }, {
            "offset": 1,
            "color": "#ec2e85" // 100% 处的颜色
        }], false)
		}else if(num ==2){
			color = new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
	            offset: 0,
	            color: '#96d668'
	        }, {
	            offset: 1,
	            color: '#01babc'
	        }], false)
		}else{
	        color = new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
	            offset: 0,
	            color: '#1a98f8'
	        }, {
	            offset: 1,
	            color: '#7049f0'
	        }], false)
        }
		return color;
	}

	var options = {
	    title: {
            /*text:title, 
            top: '1%',
            left: '1%',
            textStyle: {
                color: '#bcbfff',
                fontSize: 14,
                fontWeight: 'bold'
            }*/
        },
	    "tooltip": {
	        "trigger": "axis",
	        "axisPointer": { // 坐标轴指示器，坐标轴触发有效
	            "type": "shadow" // 默认为直线，可选为："line" | "shadow"
	        }
	    },
	    "grid": {
	    	"top": "10%",
	        "left": "3%",
	        "right": "15%",
	        "bottom": "5%",
	        "containLabel": true
	    },
	    "yAxis": [{
	        "type": "category",
	        "data": dataTitle,
	        "axisLine": {
	            "show": true,
	            "lineStyle":{
	            	"color": '#ffffff'
	            }
	            
	        },
	        "axisTick": {
	            "show": false,
	            "alignWithLabel": true
	        },
	        "axisLabel": {
	            "textStyle": {
	                "color": "#FFFFFF"
	            }
	        }
	    }],
	    "xAxis": [{
	        "type": "value",
	        "axisLine": {
	            "show": false
	        },
	        "axisTick": {
	            "show": false
	        },
	        "axisLabel": {
	            "show": false
	        },
	        "splitLine": {
	            "show": false
	        }
	    }],
	
	    "series": [{
	        "name": "税收额",
	        "type": "bar",
	        "data": convertData,
	        "barCategoryGap": "35%",
	        "label": {
	            "normal": {
	                "show": true,
	                "position": "right",
	                "formatter": function(params) {
	                    return params.data.value;
	                },
	                "textStyle": {
	                    "color": "#bcbfff" //color of value
	                }
	            }
	        },
	        "itemStyle": {
	            "normal": {
	                /*"color": new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
	                    "offset": 0,
	                    "color": "#ffb069" // 0% 处的颜色
	                }, {
	                    "offset": 1,
	                    "color": "#ec2e85" // 100% 处的颜色
	                }], false)*/
	               "color": '#35acfe'
	            }
	        }
	    }]
	};
	// 使用刚指定的配置项和数据显示图表。
	myChart.setOption(options);
}

//地区少数民族分布
function minoritiDistribute(id){
	var echartWidth = $(window).width() * 0.445;
	var echartHeight = $(window).height() * 0.28;
	// 基于准备好的dom，初始化echarts实例
	var myChart = echarts.init(document.getElementById(id));
	/*根据浏览器宽、高设置echarts 宽、高*/
	
	myChart.resize({
	    width: echartWidth,
	    height: echartHeight,
	});
	/*end*/
	
	var plantCap = [{
	    name: '汉族',
	    value: '222'
	}, {
	    name: '蒙古族',
	    value: '115'
	}, {
	    name: '回族',
	    value: '113'
	}, {
	    name: '藏族',
	    value: '95'
	}, {
	    name: '维吾尔族',
	    value: '92'
	}, {
	    name: '苗族',
	    value: '87'
	}, {
	    name: '壮族',
	    value: '87'
	}, {
	    name: '彝族',
	    value: '60'
	}, {
	    name: '满族',
	    value: '50'
	}];
	
	var datalist = [{
	    offset: [56, 58],
	    symbolSize: 100,
	    opacity: .95,
	    color: '#f467ce'
	}, {
	    offset: [35, 75],//第一个x轴，第二个y轴
	    symbolSize: 85,
	    opacity: .88,
	    color: '#7aabe2'
	}, {
	    offset: [20, 43],
	    symbolSize: 80,
	    opacity: .84,
	    color: '#ff7123'
	}, {
	    offset: [83, 30],
	    symbolSize: 70,
	    opacity: .8,
	    color: '#ffc400'
	}, {
	    offset: [36, 20],
	    symbolSize: 65,
	    opacity: .75,
	    color: '#b36bbf'
	}, {
	    offset: [64, 15],
	    symbolSize: 55,
	    opacity: .7,
	    color: '#009688'
	}, {
	    offset: [75, 75],
	    symbolSize: 50,
	    opacity: .68,
	    color: '#4caf50'
	}, {
	    offset: [95, 62],
	    symbolSize: 45,
	    opacity: .6,
	    color: '#2196f3'
	}, {
	    offset: [0, 62],
	    symbolSize: 45,
	    opacity: .6,
	    color: '#2196f3'
	}];
	var datas = [];
	for (var i = 0; i < plantCap.length; i++) {
	    var item = plantCap[i];
	    var itemToStyle = datalist[i];
	    datas.push({
	        name: item.value + '\n' + item.name,
	        value: itemToStyle.offset,
	        symbolSize: itemToStyle.symbolSize,
	        label: {
	            normal: {
	                textStyle: {
	                    fontSize: 11
	                }
	            }
	        },
	        itemStyle: {
	            normal: {
	                color: itemToStyle.color,
	                opacity: itemToStyle.opacity
	            }
	        },
	    })
	}
	var options = {
	    grid: {
	        show: false,
	        top: 10,
	        bottom: 10
	    },
	    xAxis: [{
	        gridIndex: 0,
	        type: 'value',
	        show: false,
	        min: 0,
	        max: 100,
	        nameLocation: 'middle',
	        nameGap: 5
	    }],
	    yAxis: [{
	        gridIndex: 0,
	        min: 0,
	        show: false,
	        max: 100,
	        nameLocation: 'middle',
	        nameGap: 30
	    }],
	    series: [{
	        type: 'scatter',
	        symbol: 'circle',
	        symbolSize: 120,
	        label: {
	            normal: {
	                show: true,
	                formatter: '{b}',
	                color: '#fff',
	                textStyle: {
	                    fontSize: '20'
	                }
	            },
	        },
	        itemStyle: {
	            normal: {
	                color: '#00acea'
	            }
	        },
	        data: datas
	    }]
	};
	// 使用刚指定的配置项和数据显示图表。
	myChart.setOption(options);
}